<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    
    <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Hugo 0.68.3 with theme Tranquilpeak 0.4.7-BETA">
<meta name="author" content="唐宋缘明卿">
<meta name="keywords" content=", development, next-gen">
<meta name="description" content="">


<meta property="og:description" content="">
<meta property="og:type" content="article">
<meta property="og:title" content="踩过的坑，流过的泪">
<meta name="twitter:title" content="踩过的坑，流过的泪">
<meta property="og:url" content="https://gaohaihang.gitee.io/ghhs_technology_blog/2017/04/%E8%B8%A9%E8%BF%87%E7%9A%84%E5%9D%91%E6%B5%81%E8%BF%87%E7%9A%84%E6%B3%AA/">
<meta property="twitter:url" content="https://gaohaihang.gitee.io/ghhs_technology_blog/2017/04/%E8%B8%A9%E8%BF%87%E7%9A%84%E5%9D%91%E6%B5%81%E8%BF%87%E7%9A%84%E6%B3%AA/">
<meta property="og:site_name" content="唐宋缘明卿的博客">
<meta property="og:description" content="">
<meta name="twitter:description" content="">
<meta property="og:locale" content="zh-cn">

  
    <meta property="article:published_time" content="2017-04-04T14:36:41">
  
  
    <meta property="article:modified_time" content="2017-04-04T14:36:41">
  
  
  
    
      <meta property="article:section" content="python">
    
  
  
    
      <meta property="article:tag" content="tag plugins">
    
      <meta property="article:tag" content="test">
    
  


<meta name="twitter:card" content="summary">







  <meta property="og:image" content="//d1u9biwaxjngwg.cloudfront.net/tag-plugins-showcase/car-6-140.jpg">
  <meta property="twitter:image" content="//d1u9biwaxjngwg.cloudfront.net/tag-plugins-showcase/car-6-140.jpg">





  <meta property="og:image" content="http://img.qq22.com.cn/uploads/4134/gubtyqxfhz2.jpg?68513786">
  <meta property="twitter:image" content="http://img.qq22.com.cn/uploads/4134/gubtyqxfhz2.jpg?68513786">


    <title>踩过的坑，流过的泪</title>

    <link rel="icon" href="https://gaohaihang.gitee.io/ghhs_technology_blog/favicon.png">
    

    

    <link rel="canonical" href="https://gaohaihang.gitee.io/ghhs_technology_blog/2017/04/%E8%B8%A9%E8%BF%87%E7%9A%84%E5%9D%91%E6%B5%81%E8%BF%87%E7%9A%84%E6%B3%AA/">

    
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.min.css" integrity="sha256-vuXZ9LGmmwtjqFX1F+EKin1ThZMub58gKULUyf0qECk=" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/helpers/jquery.fancybox-thumbs.min.css" integrity="sha256-SEa4XYAHihTcEP1f5gARTB2K26Uk8PsndQYHQC1f4jU=" crossorigin="anonymous" />
    
    
    <link rel="stylesheet" href="https://gaohaihang.gitee.io/ghhs_technology_blog/css/style-twzjdbqhmnnacqs0pwwdzcdbt8yhv8giawvjqjmyfoqnvazl0dalmnhdkvp7.min.css" />
    
    

    
      
    
    
  </head>

  <body>
    <div id="blog">
      <header id="header" data-behavior="5">
  <i id="btn-open-sidebar" class="fa fa-lg fa-bars"></i>
  <div class="header-title">
    <a class="header-title-link" href="https://gaohaihang.gitee.io/ghhs_technology_blog/">唐宋缘明卿的博客</a>
  </div>
  
    
      <a class="header-right-picture "
         href="https://gaohaihang.gitee.io/ghhs_technology_blog/#about">
    
    
    
      
        <img class="header-picture" src="http://img.qq22.com.cn/uploads/4134/gubtyqxfhz2.jpg?68513786" alt="作者的图片" />
      
    
    </a>
  
</header>

      <nav id="sidebar" data-behavior="5">
  <div class="sidebar-container">
    
      <div class="sidebar-profile">
        <a href="https://gaohaihang.gitee.io/ghhs_technology_blog/#about">
          <img class="sidebar-profile-picture" src="http://img.qq22.com.cn/uploads/4134/gubtyqxfhz2.jpg?68513786" alt="作者的图片" />
        </a>
        <h4 class="sidebar-profile-name">唐宋缘明卿</h4>
        
          <h5 class="sidebar-profile-bio">弱小的人，才习惯嘲讽与否定；内心强大的人，从不吝啬赞美与鼓励。</h5>
        
      </div>
    
    <ul class="sidebar-buttons">
      
  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://gaohaihang.gitee.io/ghhs_technology_blog/">
    
      <i class="sidebar-button-icon fa fa-lg fa-home"></i>
      
      <span class="sidebar-button-desc">首页</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://gaohaihang.gitee.io/ghhs_technology_blog/categories">
    
      <i class="sidebar-button-icon fa fa-lg fa-bookmark"></i>
      
      <span class="sidebar-button-desc">分类</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://gaohaihang.gitee.io/ghhs_technology_blog/tags">
    
      <i class="sidebar-button-icon fa fa-lg fa-tags"></i>
      
      <span class="sidebar-button-desc">标签</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://gaohaihang.gitee.io/ghhs_technology_blog/archives">
    
      <i class="sidebar-button-icon fa fa-lg fa-archive"></i>
      
      <span class="sidebar-button-desc">归档</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://gaohaihang.gitee.io/ghhs_technology_blog/resume">
    
      <i class="sidebar-button-icon fa fa-address-card"></i>
      
      <span class="sidebar-button-desc">Resume</span>
    </a>
  </li>


    </ul>
    <ul class="sidebar-buttons">
      
  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://github.com/ghh617415200" target="_blank" rel="noopener">
    
      <i class="sidebar-button-icon fa fa-lg fa-github"></i>
      
      <span class="sidebar-button-desc">GitHub</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://stackoverflow.com/users/13559927/ghh-cirs" target="_blank" rel="noopener">
    
      <i class="sidebar-button-icon fa fa-lg fa-stack-overflow"></i>
      
      <span class="sidebar-button-desc">Stack Overflow</span>
    </a>
  </li>


    </ul>
    <ul class="sidebar-buttons">
      
  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://gaohaihang.gitee.io/ghhs_technology_blog/index.xml">
    
      <i class="sidebar-button-icon fa fa-lg fa-rss"></i>
      
      <span class="sidebar-button-desc">Rss</span>
    </a>
  </li>


    </ul>
  </div>
</nav>

      

      <div id="main" data-behavior="5"
        class="
               hasCoverMetaIn
               ">
        <article class="post" itemscope itemType="http://schema.org/BlogPosting">
          
          
            <div class="post-header main-content-wrap text-left">
  
    <h1 class="post-title" itemprop="headline">
      踩过的坑，流过的泪
    </h1>
  
  
  <div class="postShorten-meta post-meta">
    
      <time itemprop="datePublished" datetime="2017-04-04T14:36:41&#43;08:00">
        
  四月 4, 2017

      </time>
    
    
  
  
    <span>发布在</span>
    
      <a class="category-link" href="https://gaohaihang.gitee.io/ghhs_technology_blog/categories/python">python</a>
    
  

  </div>

</div>
          
          <div class="post-content markdown" itemprop="articleBody">
            <div class="main-content-wrap">
              <h2 id="那些年我们踩过的那些坑">那些年我们踩过的那些坑</h2>
<h4 id="整数比较的坑">整数比较的坑</h4>
<p>在 Python 中一切都是对象，整数也是对象，在比较两个整数时有两个运算符<code>==</code>和<code>is</code>，它们的区别是：</p>
<ul>
<li><code>is</code>比较的是两个整数对象的id值是否相等，也就是比较两个引用是否代表了内存中同一个地址。</li>
<li><code>==</code>比较的是两个整数对象的内容是否相等，使用<code>==</code>时其实是调用了对象的<code>__eq__()</code>方法。</li>
</ul>
<p>知道了<code>is</code>和<code>==</code>的区别之后，我们可以来看看下面的代码，了解Python中整数比较有哪些坑：</p>
<pre><code>def main():
	x = y = -1
	while True:
		x += 1
		y += 1
		if x is y:
			print('%d is %d' % (x, y))
		else:
			print('Attention! %d is not %d' % (x, y))
			break
			
	x = y = 0
	while True:
		x -= 1
		y -= 1
		if x is y:
			print('%d is %d' % (x, y))
		else:
			print('Attention! %d is not %d' % (x, y))
			break


if __name__ == '__main__':
	main()
</code></pre><p>上面代码的部分运行结果如下图所示，出现这个结果的原因是Python出于对性能的考虑所做的一项优化。对于整数对象，Python把一些频繁使用的整数对象缓存起来，保存到一个叫<code>small_ints</code>的链表中，在Python的整个生命周期内，任何需要引用这些整数对象的地方，都不再重新创建新的对象，而是直接引用缓存中的对象。Python把频繁使用的整数对象的值定在[-5, 256]这个区间，如果需要这个范围的整数，就直接从<code>small_ints</code>中获取引用而不是临时创建新的对象。因为大于256或小于-5的整数不在该范围之内，所以就算两个整数的值是一样，但它们是不同的对象。</p>
<p><img src="https://gitee.com/gaohaihang/ghhs_technology_blog/raw/master/img/res/int-is-comparation.png" alt="res1"></p>
<p>当然仅仅如此这个坑就不值一提了，如果你理解了上面的规则，我们就再看看下面的代码。</p>
<pre><code>a = 257


def main():
	b = 257  # 第6行
	c = 257  # 第7行
	print(b is c)  # True
	print(a is b)  # False
	print(a is c)  # False


if __name__ == &quot;__main__&quot;:
	main()
</code></pre><p>程序的执行结果已经用注释写在代码上了。够坑吧！看上去<code>a</code>、<code>b</code>和<code>c</code>的值都是一样的，但是<code>is</code>运算的结果却不一样。为什么会出现这样的结果，首先我们来说说Python程序中的代码块。所谓代码块是程序的一个最小的基本执行单位，一个模块文件、一个函数体、一个类、交互式命令中的单行代码都叫做一个代码块。上面的代码由两个代码块构成，<code>a = 257</code>是一个代码块，<code>main</code>函数是另外一个代码块。Python内部为了进一步提高性能，凡是在一个代码块中创建的整数对象，如果值不在<code>small_ints</code>缓存范围之内，但在同一个代码块中已经存在一个值与其相同的整数对象了，那么就直接引用该对象，否则创建一个新的对象出来，这条规则对不在<code>small_ints</code>范围的负数并不适用，对负数值浮点数也不适用，但对非负浮点数和字符串都是适用的，这一点读者可以自行证明。所以 <code>b is c</code>返回了<code>True</code>，而<code>a</code>和<code>b</code>不在同一个代码块中，虽然值都是257，但却是两个不同的对象，<code>is</code>运算的结果自然是<code>False</code>了。
为了验证刚刚的结论，我们可以借用<code>dis</code>模块（听名字就知道是进行反汇编的模块）从字节码的角度来看看这段代码。如果不理解什么是字节码，可以先看看[《谈谈 Python 程序的运行原理》]这篇文章。可以先用<code>import dis</code>导入<code>dis</code>模块并按照如下所示的方式修改代码。</p>
<pre><code>import dis

dis.dis(main)
</code></pre><p>代码的执行结果如下图所示。可以看出代码第6行和第7行，也就是<code>main</code>函数中的257是从同一个位置加载的，因此是同一个对象；而代码第9行的<code>a</code>明显是从不同的地方加载的，因此引用的是不同的对象。</p>
<p><img src="https://gitee.com/gaohaihang/ghhs_technology_blog/raw/master/img/res/result-of-dis.png" alt="res2"></p>
              
            </div>
          </div>
          <div id="post-footer" class="post-footer main-content-wrap">
            
              
                
                
                  <div class="post-footer-tags">
                    <span class="text-color-light text-small">标签</span><br/>
                    
  <a class="tag tag--primary tag--small" href="https://gaohaihang.gitee.io/ghhs_technology_blog/tags/tag-plugins/">tag plugins</a>

  <a class="tag tag--primary tag--small" href="https://gaohaihang.gitee.io/ghhs_technology_blog/tags/test/">test</a>

                  </div>
                
              
            
            <div class="post-actions-wrap">
  
      <nav >
        <ul class="post-actions post-action-nav">
          
            <li class="post-action">
              
                <a class="post-action-btn btn btn--default tooltip--top" href="https://gaohaihang.gitee.io/ghhs_technology_blog/2017/08/jwt%E5%AE%8C%E5%85%A8%E6%94%BB%E7%95%A5/" data-tooltip="JWT完全攻略">
              
                  <i class="fa fa-angle-left"></i>
                  <span class="hide-xs hide-sm text-small icon-ml">下一篇</span>
                </a>
            </li>
            <li class="post-action">
              
                <a class="post-action-btn btn btn--default tooltip--top" href="https://gaohaihang.gitee.io/ghhs_technology_blog/2017/03/github%E6%90%9C%E7%B4%A2%E6%8A%80%E5%B7%A7%E6%B1%87%E6%80%BB/" data-tooltip="Github搜索技巧汇总">
              
                  <span class="hide-xs hide-sm text-small icon-mr">上一篇</span>
                  <i class="fa fa-angle-right"></i>
                </a>
            </li>
          
        </ul>
      </nav>
    <ul class="post-actions post-action-share" >
      
        <li class="post-action hide-lg hide-md hide-sm">
          <a class="post-action-btn btn btn--default btn-open-shareoptions" href="#btn-open-shareoptions">
            <i class="fa fa-share-alt"></i>
          </a>
        </li>
        
          <li class="post-action hide-xs">
            <a class="post-action-btn btn btn--default" target="new" href="https://www.facebook.com/sharer/sharer.php?u=https://gaohaihang.gitee.io/ghhs_technology_blog/2017/04/%E8%B8%A9%E8%BF%87%E7%9A%84%E5%9D%91%E6%B5%81%E8%BF%87%E7%9A%84%E6%B3%AA/">
              <i class="fa fa-facebook-official"></i>
            </a>
          </li>
        
          <li class="post-action hide-xs">
            <a class="post-action-btn btn btn--default" target="new" href="https://twitter.com/intent/tweet?text=https://gaohaihang.gitee.io/ghhs_technology_blog/2017/04/%E8%B8%A9%E8%BF%87%E7%9A%84%E5%9D%91%E6%B5%81%E8%BF%87%E7%9A%84%E6%B3%AA/">
              <i class="fa fa-twitter"></i>
            </a>
          </li>
        
          <li class="post-action hide-xs">
            <a class="post-action-btn btn btn--default" target="new" href="https://plus.google.com/share?url=https://gaohaihang.gitee.io/ghhs_technology_blog/2017/04/%E8%B8%A9%E8%BF%87%E7%9A%84%E5%9D%91%E6%B5%81%E8%BF%87%E7%9A%84%E6%B3%AA/">
              <i class="fa fa-google-plus"></i>
            </a>
          </li>
        
      
      
        <li class="post-action">
          <a class="post-action-btn btn btn--default" href="#disqus_thread">
            <i class="fa fa-comment-o"></i>
          </a>
        </li>
      
      <li class="post-action">
        
          <a class="post-action-btn btn btn--default" href="#">
        
          <i class="fa fa-list"></i>
        </a>
      </li>
    </ul>
  
</div>

            
              
                <div id="disqus_thread">
  <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
              
            
          </div>
        </article>
        <footer id="footer" class="main-content-wrap">
  <span class="copyrights">
    &copy; 2020 唐宋缘明卿. All Rights Reserved
  </span>
</footer>

      </div>
      <div id="bottom-bar" class="post-bottom-bar" data-behavior="5">
        <div class="post-actions-wrap">
  
      <nav >
        <ul class="post-actions post-action-nav">
          
            <li class="post-action">
              
                <a class="post-action-btn btn btn--default tooltip--top" href="https://gaohaihang.gitee.io/ghhs_technology_blog/2017/08/jwt%E5%AE%8C%E5%85%A8%E6%94%BB%E7%95%A5/" data-tooltip="JWT完全攻略">
              
                  <i class="fa fa-angle-left"></i>
                  <span class="hide-xs hide-sm text-small icon-ml">下一篇</span>
                </a>
            </li>
            <li class="post-action">
              
                <a class="post-action-btn btn btn--default tooltip--top" href="https://gaohaihang.gitee.io/ghhs_technology_blog/2017/03/github%E6%90%9C%E7%B4%A2%E6%8A%80%E5%B7%A7%E6%B1%87%E6%80%BB/" data-tooltip="Github搜索技巧汇总">
              
                  <span class="hide-xs hide-sm text-small icon-mr">上一篇</span>
                  <i class="fa fa-angle-right"></i>
                </a>
            </li>
          
        </ul>
      </nav>
    <ul class="post-actions post-action-share" >
      
        <li class="post-action hide-lg hide-md hide-sm">
          <a class="post-action-btn btn btn--default btn-open-shareoptions" href="#btn-open-shareoptions">
            <i class="fa fa-share-alt"></i>
          </a>
        </li>
        
          <li class="post-action hide-xs">
            <a class="post-action-btn btn btn--default" target="new" href="https://www.facebook.com/sharer/sharer.php?u=https://gaohaihang.gitee.io/ghhs_technology_blog/2017/04/%E8%B8%A9%E8%BF%87%E7%9A%84%E5%9D%91%E6%B5%81%E8%BF%87%E7%9A%84%E6%B3%AA/">
              <i class="fa fa-facebook-official"></i>
            </a>
          </li>
        
          <li class="post-action hide-xs">
            <a class="post-action-btn btn btn--default" target="new" href="https://twitter.com/intent/tweet?text=https://gaohaihang.gitee.io/ghhs_technology_blog/2017/04/%E8%B8%A9%E8%BF%87%E7%9A%84%E5%9D%91%E6%B5%81%E8%BF%87%E7%9A%84%E6%B3%AA/">
              <i class="fa fa-twitter"></i>
            </a>
          </li>
        
          <li class="post-action hide-xs">
            <a class="post-action-btn btn btn--default" target="new" href="https://plus.google.com/share?url=https://gaohaihang.gitee.io/ghhs_technology_blog/2017/04/%E8%B8%A9%E8%BF%87%E7%9A%84%E5%9D%91%E6%B5%81%E8%BF%87%E7%9A%84%E6%B3%AA/">
              <i class="fa fa-google-plus"></i>
            </a>
          </li>
        
      
      
        <li class="post-action">
          <a class="post-action-btn btn btn--default" href="#disqus_thread">
            <i class="fa fa-comment-o"></i>
          </a>
        </li>
      
      <li class="post-action">
        
          <a class="post-action-btn btn btn--default" href="#">
        
          <i class="fa fa-list"></i>
        </a>
      </li>
    </ul>
  
</div>

      </div>
      <div id="share-options-bar" class="share-options-bar" data-behavior="5">
  <i id="btn-close-shareoptions" class="fa fa-close"></i>
  <ul class="share-options">
    
      <li class="share-option">
        <a class="share-option-btn" target="new" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fgaohaihang.gitee.io%2Fghhs_technology_blog%2F2017%2F04%2F%25E8%25B8%25A9%25E8%25BF%2587%25E7%259A%2584%25E5%259D%2591%25E6%25B5%2581%25E8%25BF%2587%25E7%259A%2584%25E6%25B3%25AA%2F">
          <i class="fa fa-facebook-official"></i><span>分享到 Facebook</span>
        </a>
      </li>
    
      <li class="share-option">
        <a class="share-option-btn" target="new" href="https://twitter.com/intent/tweet?text=https%3A%2F%2Fgaohaihang.gitee.io%2Fghhs_technology_blog%2F2017%2F04%2F%25E8%25B8%25A9%25E8%25BF%2587%25E7%259A%2584%25E5%259D%2591%25E6%25B5%2581%25E8%25BF%2587%25E7%259A%2584%25E6%25B3%25AA%2F">
          <i class="fa fa-twitter"></i><span>分享到 Twitter</span>
        </a>
      </li>
    
      <li class="share-option">
        <a class="share-option-btn" target="new" href="https://plus.google.com/share?url=https%3A%2F%2Fgaohaihang.gitee.io%2Fghhs_technology_blog%2F2017%2F04%2F%25E8%25B8%25A9%25E8%25BF%2587%25E7%259A%2584%25E5%259D%2591%25E6%25B5%2581%25E8%25BF%2587%25E7%259A%2584%25E6%25B3%25AA%2F">
          <i class="fa fa-google-plus"></i><span>分享到 Google&#43;</span>
        </a>
      </li>
    
  </ul>
</div>
<div id="share-options-mask" class="share-options-mask"></div>
    </div>
    
    <div id="about">
  <div id="about-card">
    <div id="about-btn-close">
      <i class="fa fa-remove"></i>
    </div>
    
      <img id="about-card-picture" src="http://img.qq22.com.cn/uploads/4134/gubtyqxfhz2.jpg?68513786" alt="作者的图片" />
    
    <h4 id="about-card-name">唐宋缘明卿</h4>
    
      <div id="about-card-bio">弱小的人，才习惯嘲讽与否定；内心强大的人，从不吝啬赞美与鼓励。</div>
    
    
      <div id="about-card-job">
        <i class="fa fa-briefcase"></i>
        <br/>
        python全栈工程师
      </div>
    
    
      <div id="about-card-location">
        <i class="fa fa-map-marker"></i>
        <br/>
        中国 北京
      </div>
    
  </div>
</div>

    

    
  
    
      <div id="cover" style="background-image:url('https://gaohaihang.gitee.io/ghhs_technology_blog/images/cover.jpg');"></div>
    
  


    
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js" integrity="sha256-/BfiIkHlHoVihZdc6TFuj7MmJ0TWcWsMXkeDFwhi0zw=" crossorigin="anonymous"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.7/js/jquery.fancybox.min.js" integrity="sha256-GEAnjcTqVP+vBp3SSc8bEDQqvWAZMiHyUSIorrWwH50=" crossorigin="anonymous"></script>


<script src="https://gaohaihang.gitee.io/ghhs_technology_blog/js/script-pcw6v3xilnxydl1vddzazdverrnn9ctynvnxgwho987mfyqkuylcb1nlt.min.js"></script>


<script lang="javascript">
window.onload = updateMinWidth;
window.onresize = updateMinWidth;
document.getElementById("sidebar").addEventListener("transitionend", updateMinWidth);
function updateMinWidth() {
  var sidebar = document.getElementById("sidebar");
  var main = document.getElementById("main");
  main.style.minWidth = "";
  var w1 = getComputedStyle(main).getPropertyValue("min-width");
  var w2 = getComputedStyle(sidebar).getPropertyValue("width");
  var w3 = getComputedStyle(sidebar).getPropertyValue("left");
  main.style.minWidth = `calc(${w1} - ${w2} - ${w3})`;
}
</script>

<script>
$(document).ready(function() {
  hljs.configure({ classPrefix: '', useBR: false });
  $('pre.code-highlight > code, pre > code').each(function(i, block) {
    if (!$(this).hasClass('codeblock')) {
      $(this).addClass('codeblock');
    }
    hljs.highlightBlock(block);
  });
});
</script>


  
    
      <script>
        var disqus_config = function () {
          this.page.url = 'https:\/\/gaohaihang.gitee.io\/ghhs_technology_blog\/2017\/04\/%E8%B8%A9%E8%BF%87%E7%9A%84%E5%9D%91%E6%B5%81%E8%BF%87%E7%9A%84%E6%B3%AA\/';
          
            this.page.identifier = '\/2017\/04\/%E8%B8%A9%E8%BF%87%E7%9A%84%E5%9D%91%E6%B5%81%E8%BF%87%E7%9A%84%E6%B3%AA\/'
          
        };
        (function() {
          
          
          if (window.location.hostname == "localhost") {
            return;
          }
          var d = document, s = d.createElement('script');
          var disqus_shortname = 'hugo-tranquilpeak-theme';
          s.src = '//' + disqus_shortname + '.disqus.com/embed.js';

          s.setAttribute('data-timestamp', +new Date());
          (d.head || d.body).appendChild(s);
        })();
      </script>
    
  




    
  </body>
</html>

